package com.yituo.mjworld.mvc.form;

import com.yituo.mjworld.core.annotation.Rules;
import com.yituo.mjworld.core.web.core.BaseForm;

/**
 * 查询表单
 *
 * @author xq
 */
public class QueryForm extends BaseForm {
  
  @Rules(fieldName = "排序方式", required = false)
  public boolean asc;
  /**
   * 最小值为1
   */
  @Rules(fieldName = "页码", min = "1")
  public int page = 1;
  /**
   * 默认值为10,最小值为1,最大值为30.
   */
  @Rules(fieldName = "行数", min = "1", max = "30")
  public int rows = 10;

  public int getPage() {
    return page;
  }

  public void setPage(int page) {
    this.page = page;
  }

  public int getRows() {
    return rows;
  }

  public void setRows(int rows) {
    this.rows = rows;
  }

  public boolean isAsc() {
    return asc;
  }

  public void setAsc(boolean asc) {
    this.asc = asc;
  }

  /**
   * 重写验证方法
   *
   * @return
   */
  @Override
  public boolean validate() {
    // call defaultValidate
    return defaultValidate();
  }
}
